import { defineStore } from 'pinia'

export const useExhibitionListStore = defineStore('exhibitionList', {
  state: () => ({
    searchForm: {
      chinese_name: '',
      city: '',
      industry: null,
      continent: '',
      country: '',
      exhibition_number: ''
    },
    pagination: {
        sortBy: 'desc',
        descending: false,
        page: 1,
        rowsPerPage: 10,
        rowsNumber: 0  // 总记录数
    }
  }),
  actions: {
    setSearchForm(form) {
      this.searchForm = { ...form }
    },
    setPagination(pagination) {
      this.pagination = { ...pagination }
    },
    resetState() {
      this.searchForm = {
        chinese_name: '',
        city: '',
        industry: null,
        exhibition_number: ''
      }
      this.pagination = {
        sortBy: 'desc',
        descending: false,
        page: 1,
        rowsPerPage: 10,
        rowsNumber: 0  // 总记录数
      }
    }
  }
})
